home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Networking / SNMP / SNMP Development / MacSNMP Developer 1.0.2 / Sample Agent / Sources / SampleVar.h < prev   
Encoding:
C/C++ Source or Header  |  1993-06-15  |  3.0 KB  |  95 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        SampleVar.h
  3.  
  4.     Contains:    Declarations for the various variables
  5.  
  6.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  7.  
  8. */
  9.  
  10. #ifndef __SAMPLEVAR__
  11. #define __SAMPLEVAR__
  12.  
  13. #ifndef __TYPES__
  14. #include <Types.h>
  15. #endif
  16.  
  17. #ifndef __SNMP__
  18. #include <SNMP.h>
  19. #endif
  20.  
  21. #ifndef __TSNMP__
  22. #include <TSNMP.h>
  23. #endif
  24.  
  25.  
  26.  
  27. /*********************************************************************************
  28.     TSampleDirectVar
  29.     
  30.     This variable class is initialized with a pointer to a variable storage 
  31.     location and the size of the variable.  The GetVariable, GetNextVariable, and
  32.     SetVariable member functions will manipulate the variable storage directly
  33.     in order to get or set the variable data.
  34. **********************************************************************************/
  35. #define kTSampleDirectVarID "snmp:var$TSampleDirectVar"
  36. class TSampleDirectVar : public TDevSNMPVar
  37. {
  38.     public:
  39.                         TSampleDirectVar();
  40.         virtual            ~TSampleDirectVar();
  41.         virtual    OSErr    InitSampleDirectVar(
  42.                                 TSNMPAgent* agent,                 // the agent who manages the variable
  43.                                 ObjectIDPtr id,                 // unique identifier of the variable
  44.                                 short         precedence,         // lowest value gets responsibility
  45.                                 ASNTagType    type,                // defines variable encoding
  46.                                 SMIAccess     access,             // read/write, read-only, or no access
  47.                                 short        descResID,            // resource id of description  STR# resource
  48.                                 short        descStrIndex,        // index of description string in STR# resource
  49.                                 void*        dataPtr,
  50.                                 short        dataSize);
  51.  
  52.         virtual    OSErr    GetVariable(Boolean next,ObjectIDPtr, VarBuf*);
  53.         virtual OSErr    SetVariable(ObjectIDPtr, VarBuf*, SetStage);
  54.         
  55.     private:
  56.         char*            fDataPtr;
  57.         short            fDataSize;                                        
  58. };
  59.  
  60. /*********************************************************************************
  61.     TSampleIndirectVar
  62.     
  63.     This variable class is initialized with pointers to a get and a set
  64.     function.  The GetVariable and SetVariable member
  65.     functions will call the get or set functions to perform the requested
  66.     get or set of the variable data.
  67. **********************************************************************************/
  68. #define kTSampleIndirectVarID "snmp:var$TSampleIndirectVar"
  69. class TSampleIndirectVar : public TDevSNMPVar
  70. {
  71.     public:
  72.                         TSampleIndirectVar();
  73.         virtual            ~TSampleIndirectVar();
  74.         
  75.         virtual    OSErr    InitSampleIndirectVar(
  76.                                 TSNMPAgent* agent,             // the agent who manages this variable
  77.                                 ObjectIDPtr id,             // unique identifier of the variable
  78.                                 short         precedence,     // lowest value gets responsibility
  79.                                 ASNTagType    type,            // defines variable encoding
  80.                                 SMIAccess     access,         // read/write, read-only, or no access
  81.                                 short        descResID,        // resource id of description  STR# resource
  82.                                 short        descStrIndex,    // index of description string in STR# resource
  83.                                 GetVarProcPtr getProc,
  84.                                 SetVarProcPtr setProc);
  85.  
  86.         virtual    OSErr    GetVariable(Boolean next,ObjectIDPtr, VarBuf*);
  87.         virtual OSErr    SetVariable(ObjectIDPtr, VarBuf*, SetStage);
  88.         
  89.     private:
  90.         GetVarProcPtr    fGetProc;
  91.           SetVarProcPtr    fSetProc;    // size of the value
  92. };
  93.  
  94. #endif __SAMPLEVAR__
  95.